﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <meta name="renderer" content="webkit">
    <title>大众之旅</title>
    <link href="/static/home/css/normalize.css" rel="stylesheet">
    <link href="/static/home/css/bootatrap/bootstrap.min.css" rel="stylesheet">
    <link href="/static/home/css/style.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
</head>

<body>
    <!-- 注册 -->
    <div class="login">
        <div class="top">
            <div class="typearea">
                <img src="/static/home/img/logo.png" alt="">
                <span class="name">中国生态农副产品商城</span>
                <div class="fr">
                    <span>还没有有账户</span>
                    <a href="register.html">立即注册</a>
                </div>
            </div>
        </div>
        <div class="center">
            <div class="typearea">
                <form class="fr" id="form-admin-add">
                    <div class="input-group">
                        <span class="input-group-addon glyphicon glyphicon-user" id="sizing-addon2"></span>
                        <input type="text" class="form-control" name="phone" placeholder="请输入账号(注册手机号)" aria-describedby="sizing-addon2">
                    </div>
                    <div class="input-group mt_10">
                        <span class="input-group-addon glyphicon glyphicon-lock" id="sizing-addon1"></span>
                        <input type="password" class="form-control" name="password" placeholder="请输入密码"
                            aria-describedby="sizing-addon1">
                    </div>
                    <!-- <div class="checkbox">
                        <label>
                            <input type="checkbox"> 请保存我这次的登录信息
                        </label>
                    </div> -->
                    <button type="submit" class="btn btn-default">登录</button>

                </form>
            </div>
        </div>
        <div class="typearea">
            <div class="copyright">
                版权所有 © 2004-2020 大众之旅官方商城 鄂ICP备00000000号
            </div>
        </div>
    </div>
    <script src="/static/home/js/bootstrap/jquery.min.js"></script>
    <script src="/static/home/js/bootstrap/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
    <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
    <script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script type="text/javascript" src="/static/lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript">
    $(function(){
        $("#form-admin-add").validate({
            rules:{
                password:{
                    required:true,
                    minlength:6,
                    maxlength:16
                },
                phone:{
                    required:true,
                    minlength:11,
                    maxlength:11
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "{:url('login')}",
                    success: function(data){
                        console.log(data)
                        if(data.code==200){
                            window.localStorage.setItem("Token",data.data.Token);
                            window.history.go(-1);
                        }else{
                            layer.msg(data.msg,{icon:2,time:3000});
                        }

                    }
                });
            }
        });
    });
    </script>
</body>
    
</html>